package com.huaxiafinance.management.model;

import com.huaxiafinance.management.dto.request.OrgDto;
import org.apache.commons.lang.StringUtils;

import java.util.Date;

public class Org {
	private Integer id;

	private String orgCode;

	private String orgName;

	private String orgManager;

	private String parentOrgCode;

	private Integer isEnable;

	private String inputOrg;

	private Date createdAt;

	private Date updatedAt;

	public String getInputOrg() {
		return inputOrg;
	}

	public void setInputOrg(String inputOrg) {
		this.inputOrg = inputOrg;
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getOrgCode() {
		return orgCode;
	}

	public void setOrgCode(String orgCode) {
		this.orgCode = orgCode == null ? null : orgCode.trim();
	}

	public String getOrgName() {
		return orgName;
	}

	public void setOrgName(String orgName) {
		this.orgName = orgName == null ? null : orgName.trim();
	}

	public String getOrgManager() {
		return orgManager;
	}

	public void setOrgManager(String orgManager) {
		this.orgManager = orgManager == null ? null : orgManager.trim();
	}

	public String getParentOrgCode() {
		return parentOrgCode;
	}

	public void setParentOrgCode(String parentOrgCode) {
		this.parentOrgCode = parentOrgCode == null ? null : parentOrgCode.trim();
	}

	public Integer getIsEnable() {
		return isEnable;
	}

	public void setIsEnable(Integer isEnable) {
		this.isEnable = isEnable;
	}

	public Date getCreatedAt() {
		return createdAt;
	}

	public void setCreatedAt(Date createdAt) {
		this.createdAt = createdAt;
	}

	public Date getUpdatedAt() {
		return updatedAt;
	}

	public void setUpdatedAt(Date updatedAt) {
		this.updatedAt = updatedAt;
	}

	public Org() {
	}

	public Org(OrgDto dto) {
		this.orgCode = dto.getOrgCode();
		
		if (StringUtils.isNotBlank(dto.getInputOrg()))
			this.inputOrg = dto.getInputOrg();

		if (StringUtils.isNotBlank(dto.getOrgName()))
			this.orgName = dto.getOrgName();

		if (StringUtils.isNotBlank(dto.getOrgManager()))
			this.orgManager = dto.getOrgManager();
		
		if (dto.getIsEnable() != null)
			this.isEnable = dto.getIsEnable();
	}
}